import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useAuthStore = defineStore('auth', () => {
  const token = ref(null)
  
  const setToken = (newToken) => {
    token.value = newToken
    // 可选：保存到 localStorage
    // localStorage.setItem('token', newToken)
  }
  
  const clearToken = () => {
    token.value = null
    // 可选：清除 localStorage
    // localStorage.removeItem('token')
  }
  
  return {
    token,
    setToken,
    clearToken
  }
})